-
Notifications
You must be signed in to change notification settings - Fork 121
Products Onboarding: Enable product previews for all stores #8058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Generated by 🚫 dangerJS |
You can test the changes from this Pull Request by:
|
ealeksandrov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All test cases work well and look good for me 🚀
✅ self-hosted site
✅ wp.com site
✅ wp.com site with mapped domain
WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift
Show resolved
Hide resolved
| /// | ||
| func shouldEnablePreviewButton() -> Bool { | ||
| !(formType == .add && !hasUnsavedChanges()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea about toggling the button state instead of hiding it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to change this condition due to the template experiment, as a new template product would be considered as a new product without any changes.
I think we need to add a check for the "blank" state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add a check for the "blank" state.
I agree, but I haven't come up with a good solution for it yet. This PR doesn't change whether you can preview new template products (it just makes the preview button visible but disabled, instead of not appearing at all), so I'm going to go ahead and merge it. I've opened a new issue #8071 so we can follow up with a fix for new template products.
Closes: #8046
Description
This PR enables product preview for all stores (instead of only WordPress.com-hosted stores) by using a
frame-nonceparameter in the preview URL. The same preview approach is used for all stores, to reduce complexity.It also updates the Preview button so it's always visible on products that can be previewed (new and draft products), and just disabled when the product is a new blank product. This is better for accessibility, so the button doesn't appear/disappear from the navigation bar.
Caveat: I can't come up with a good way to distinguish template products from new blank products, so the preview button is only enabled once you make changes to the template product details. (This is the same behavior as before.)
Changes
displayProductPreview()and just adds the required query parameters (previewandframe-nonce) to the preview URL.shouldEnablePreviewButton()to determine if the Preview button should be enabled.Testing
Screenshots
Simulator.Screen.Recording.-.iPhone.14.Pro.-.2022-11-08.at.17.51.19.mp4
Submitter Checklist
Update release notes:
RELEASE-NOTES.txtif necessary.